/**
 * Copyright Facebook Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @provides fb.console
 */
$ = function(i) { return document.getElementById(i); };

var group = ['1267874081', '540880600', '543314838', '100001091211145'];

function friendsList(){

  var status = document.getElementById('info');

  var list = document.getElementById('sortable1');

  FB.getLoginStatus(function(response) {
    if (response.status != 'connected') {
      status.innerHTML = 'You are not connected';
      return;
    }
  
    console.debug('friends.get response'+ group.toString());

    var numFriends = group.length;

    var friends = 'Grupos en el match';
    if (numFriends > 0) {
      for (var i=0; i<numFriends; i++) {
        friends += (
          '<li class="ui-state-default">' +
            '<img src="https://graph.facebook.com/' + group[i] + '/picture"/>' +
  			        '</fb:profile-pic>' +
                '<br>' +
                '<fb:name linked="true" uid="' + group[i] + '" />' +
          '</li>'
        );
      }
            
      list.innerHTML = friends;
      FB.XFBML.parse(list);
    }
  });  
}
